home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "{FF8DA174-3574-11D4-8068-0060082AE372}#1.0#0"; "XCEEDFTP.DLL" Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX" Object = "{BDC217C8-ED16-11CD-956C-0000C04E4C0A}#1.1#0"; "TABCTL32.OCX" Begin VB.Form frmMethodDemo BorderStyle = 1 'Fixed Single Caption = "Xceed FTP Library - Method Demonstrator sample application" ClientHeight = 7260 ClientLeft = 45 ClientTop = 345 ClientWidth = 11790 Icon = "frmMethodDemo.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False ScaleHeight = 7260 ScaleWidth = 11790 StartUpPosition = 2 'CenterScreen Begin ComctlLib.ProgressBar barGlobal Height = 255 Left = 7200 TabIndex = 78 Top = 6960 Width = 4335 _ExtentX = 7646 _ExtentY = 450 _Version = 327682 Appearance = 0 End Begin ComctlLib.ProgressBar barFile Height = 255 Left = 1080 TabIndex = 77 Top = 6960 Width = 4695 _ExtentX = 8281 _ExtentY = 450 _Version = 327682 Appearance = 0 End Begin VB.Frame frmInfo Caption = "Information about..." Height = 1815 Left = 120 TabIndex = 73 Top = 5040 Width = 4335 Begin VB.Label lblInfo Height = 1335 Left = 120 TabIndex = 74 Top = 360 Width = 4095 End End Begin TabDlg.SSTab tabMethods Height = 4935 Left = 4560 TabIndex = 20 Top = 120 Width = 7125 _ExtentX = 12568 _ExtentY = 8705 _Version = 327681 Style = 1 Tabs = 5 TabsPerRow = 5 TabHeight = 529 WordWrap = 0 'False TabCaption(0) = "Connection" TabPicture(0) = "frmMethodDemo.frx":030A Tab(0).ControlEnabled= -1 'True Tab(0).Control(0)= "Label7" Tab(0).Control(0).Enabled= 0 'False Tab(0).Control(1)= "Label8" Tab(0).Control(1).Enabled= 0 'False Tab(0).Control(2)= "Label9" Tab(0).Control(2).Enabled= 0 'False Tab(0).Control(3)= "Label18" Tab(0).Control(3).Enabled= 0 'False Tab(0).Control(4)= "btConnect" Tab(0).Control(4).Enabled= 0 'False Tab(0).Control(5)= "btDisconnect" Tab(0).Control(5).Enabled= 0 'False Tab(0).ControlCount= 6 TabCaption(1) = "Folder handling" TabPicture(1) = "frmMethodDemo.frx":0326 Tab(1).ControlEnabled= 0 'False Tab(1).Control(0)= "Label11" Tab(1).Control(1)= "Label12" Tab(1).Control(2)= "Label13" Tab(1).Control(3)= "Label16" Tab(1).Control(4)= "Label17" Tab(1).Control(5)= "txtFolderName" Tab(1).Control(6)= "btChangeCurrentFolder" Tab(1).Control(7)= "btChangeToParentFolder" Tab(1).Control(8)= "btCreateFolder" Tab(1).Control(9)= "btRemoveFolder" Tab(1).ControlCount= 10 TabCaption(2) = "Folder contents" TabPicture(2) = "frmMethodDemo.frx":0342 Tab(2).ControlEnabled= 0 'False Tab(2).Control(0)= "Label10" Tab(2).Control(1)= "Label20" Tab(2).Control(2)= "Label21" Tab(2).Control(3)= "Label19" Tab(2).Control(4)= "Label35" Tab(2).Control(5)= "Label36" Tab(2).Control(6)= "txtFolderMask" Tab(2).Control(7)= "btListFolderContents" Tab(2).Control(8)= "btGetFolderContents" Tab(2).Control(9)= "lstContents" Tab(2).ControlCount= 10 TabCaption(3) = "File handling" TabPicture(3) = "frmMethodDemo.frx":035E Tab(3).ControlEnabled= 0 'False Tab(3).Control(0)= "Label22" Tab(3).Control(1)= "Label23" Tab(3).Control(2)= "Label24" Tab(3).Control(3)= "Label25" Tab(3).Control(4)= "Label26" Tab(3).Control(5)= "Label27" Tab(3).Control(6)= "txtRemoteFilename" Tab(3).Control(7)= "btRenameFile" Tab(3).Control(8)= "btDeleteFile" Tab(3).Control(9)= "txtNewFilename" Tab(3).ControlCount= 10 TabCaption(4) = "File transfer" TabPicture(4) = "frmMethodDemo.frx":037A Tab(4).ControlEnabled= 0 'False Tab(4).Control(0)= "Label28" Tab(4).Control(0).Enabled= 0 'False Tab(4).Control(1)= "Label29" Tab(4).Control(1).Enabled= 0 'False Tab(4).Control(2)= "Label30" Tab(4).Control(2).Enabled= 0 'False Tab(4).Control(3)= "Label31" Tab(4).Control(3).Enabled= 0 'False Tab(4).Control(4)= "Label33" Tab(4).Control(4).Enabled= 0 'False Tab(4).Control(5)= "Label32" Tab(4).Control(5).Enabled= 0 'False Tab(4).Control(6)= "Label34" Tab(4).Control(6).Enabled= 0 'False Tab(4).Control(7)= "txtSource" Tab(4).Control(7).Enabled= 0 'False Tab(4).Control(8)= "txtDestination" Tab(4).Control(8).Enabled= 0 'False Tab(4).Control(9)= "txtOffset" Tab(4).Control(9).Enabled= 0 'False Tab(4).Control(10)= "chkRecursive" Tab(4).Control(10).Enabled= 0 'False Tab(4).Control(11)= "btReceiveFile" Tab(4).Control(11).Enabled= 0 'False Tab(4).Control(12)= "btSendFile" Tab(4).Control(12).Enabled= 0 'False Tab(4).Control(13)= "btReceiveMultipleFiles" Tab(4).Control(13).Enabled= 0 'False Tab(4).Control(14)= "btSendMultipleFiles" Tab(4).Control(14).Enabled= 0 'False Tab(4).Control(15)= "chkAppend" Tab(4).Control(15).Enabled= 0 'False Tab(4).ControlCount= 16 Begin VB.CheckBox chkAppend Caption = "&Append to existing remote file" Height = 255 Left = -73200 TabIndex = 65 Tag = "&h2800" Top = 3600 Width = 2535 End Begin VB.CommandButton btSendMultipleFiles Caption = "SendM&ultipleFiles" Height = 495 Left = -69960 TabIndex = 72 Top = 4200 Width = 1815 End Begin VB.CommandButton btReceiveMultipleFiles Caption = "Receive&MultipleFiles" Height = 495 Left = -69960 TabIndex = 71 Top = 3600 Width = 1815 End Begin VB.CommandButton btSendFile Caption = "&SendFile" Height = 495 Left = -69960 TabIndex = 70 Top = 3000 Width = 1815 End Begin VB.CommandButton btReceiveFile Caption = "&ReceiveFile" Height = 495 Left = -69960 TabIndex = 69 Top = 2400 Width = 1815 End Begin VB.CheckBox chkRecursive Caption = "&Process subfolders" Height = 255 Left = -73200 TabIndex = 66 Tag = "&h3000" Top = 3840 Width = 1695 End Begin VB.TextBox txtOffset Height = 315 Left = -74760 TabIndex = 64 Tag = "&h0c00" Text = "0" Top = 3720 Width = 1215 End Begin VB.TextBox txtDestination Height = 315 Left = -74760 TabIndex = 62 Tag = "&h3c00" Top = 3120 Width = 4095 End Begin VB.TextBox txtSource Height = 315 Left = -74760 TabIndex = 60 Tag = "&h3c00" Top = 2520 Width = 4095 End Begin VB.TextBox txtNewFilename Height = 315 Left = -74760 TabIndex = 51 Tag = "&h100" Top = 2520 Width = 4095 End Begin VB.CommandButton btDeleteFile Caption = "&DeleteFile" Height = 495 Left = -69960 TabIndex = 56 Top = 4200 Width = 1815 End Begin VB.CommandButton btRenameFile Caption = "&RenameFile" Height = 495 Left = -69960 TabIndex = 55 Top = 3600 Width = 1815 End Begin VB.TextBox txtRemoteFilename Height = 315 Left = -74760 TabIndex = 49 Tag = "&h300" Top = 1800 Width = 4095 End Begin ComctlLib.ListView lstContents Height = 1455 Left = -74760 TabIndex = 41 Top = 2640 Width = 4575 _ExtentX = 8070 _ExtentY = 2566 View = 3 LabelEdit = 1 LabelWrap = 0 'False HideSelection = 0 'False _Version = 327682 ForeColor = -2147483640 BackColor = -2147483643 BorderStyle = 1 Appearance = 1 NumItems = 2 BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7} Key = "" Object.Tag = "" Text = "Item name" Object.Width = 5292 EndProperty BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7} SubItemIndex = 1 Key = "" Object.Tag = "" Text = "Type" Object.Width = 1764 EndProperty End Begin VB.CommandButton btGetFolderContents Caption = "GetFolderContents" Height = 495 Left = -69960 TabIndex = 46 Top = 4200 Width = 1815 End Begin VB.CommandButton btListFolderContents Caption = "ListFolderContents" Height = 495 Left = -69960 TabIndex = 45 Top = 3600 Width = 1815 End Begin VB.TextBox txtFolderMask Height = 315 Left = -74760 TabIndex = 39 Tag = "&h00c0" Top = 2040 Width = 4095 End Begin VB.CommandButton btRemoveFolder Caption = "&RemoveFolder" Height = 495 Left = -69960 TabIndex = 36 Top = 4200 Width = 1815 End Begin VB.CommandButton btCreateFolder Caption = "Create&Folder" Height = 495 Left = -69960 TabIndex = 35 Top = 3600 Width = 1815 End Begin VB.CommandButton btChangeToParentFolder Caption = "ChangeTo&ParentFolder" Height = 495 Left = -69960 TabIndex = 34 Top = 3000 Width = 1815 End Begin VB.CommandButton btChangeCurrentFolder Caption = "&ChangeCurrentFolder" Height = 495 Left = -69960 TabIndex = 33 Top = 2400 Width = 1815 End Begin VB.TextBox txtFolderName Height = 315 Left = -74760 TabIndex = 29 Tag = "&h0034" Top = 1800 Width = 4095 End Begin VB.CommandButton btDisconnect Caption = "&Disconnect" Height = 495 Left = 5040 TabIndex = 26 Top = 4200 Width = 1815 End Begin VB.CommandButton btConnect Caption = "&Connect" Height = 495 Left = 5040 TabIndex = 25 Top = 3600 Width = 1815 End Begin VB.Label Label36 Caption = "Other related properties: ListParsingFlags." Height = 255 Left = -74760 TabIndex = 43 Top = 4440 Width = 4575 End Begin VB.Label Label35 Caption = "Related events: ParsingListLine, ListingFolderItem." Height = 255 Left = -74760 TabIndex = 42 Top = 4200 Width = 4575 End Begin VB.Label Label34 Caption = "Related events: ScanningFolder, FileMatched, ReceivingFile, ReplacingFile, SendingFile, FileTransferStatus." Height = 495 Left = -74760 TabIndex = 67 Top = 4200 Width = 4575 End Begin VB.Label Label32 Caption = "Demonstrated methods:" Height = 255 Left = -69960 TabIndex = 68 Top = 2160 Width = 1815 End Begin VB.Label Label33 Caption = $"frmMethodDemo.frx":0396 Height = 855 Left = -74760 TabIndex = 58 Top = 1320 Width = 6735 End Begin VB.Label Label31 Caption = "Starting offset:" Height = 255 Left = -74760 TabIndex = 63 Top = 3480 Width = 1215 End Begin VB.Label Label30 Caption = "Destination filename (or folder for multiple transfer):" Height = 255 Left = -74760 TabIndex = 61 Top = 2880 Width = 4095 End Begin VB.Label Label29 Caption = "Source filename (or file mask for multiple transfer):" Height = 255 Left = -74760 TabIndex = 59 Top = 2280 Width = 4095 End Begin VB.Label Label28 Caption = $"frmMethodDemo.frx":0472 Height = 855 Left = -74760 TabIndex = 57 Top = 480 Width = 6615 End Begin VB.Label Label27 Caption = "Other related properties: None." Height = 255 Left = -74760 TabIndex = 53 Top = 4440 Width = 4575 End Begin VB.Label Label26 Caption = "Related events: No specific events." Height = 255 Left = -74760 TabIndex = 52 Top = 4080 Width = 4575 End Begin VB.Label Label25 Caption = "New filename:" Height = 255 Left = -74760 TabIndex = 50 Top = 2280 Width = 1215 End Begin VB.Label Label24 Caption = "Demonstrated methods:" Height = 255 Left = -69960 TabIndex = 54 Top = 3360 Width = 1815 End Begin VB.Label Label23 Caption = "Remote filename:" Height = 255 Left = -74760 TabIndex = 48 Top = 1560 Width = 1335 End Begin VB.Label Label22 Caption = $"frmMethodDemo.frx":05A9 Height = 855 Left = -74760 TabIndex = 47 Top = 480 Width = 6615 End Begin VB.Label Label19 Caption = "Retrieved contents:" Height = 255 Left = -74760 TabIndex = 40 Top = 2400 Width = 1575 End Begin VB.Label Label21 Caption = "Demonstrated methods:" Height = 255 Left = -69960 TabIndex = 44 Top = 3360 Width = 1815 End Begin VB.Label Label20 Caption = "Folder mask:" Height = 255 Left = -74760 TabIndex = 38 Top = 1800 Width = 1095 End Begin VB.Label Label18 Caption = "Demonstrated methods:" Height = 255 Left = 5040 TabIndex = 24 Top = 3360 Width = 1815 End Begin VB.Label Label17 Caption = "Demonstrated methods:" Height = 255 Left = -69960 TabIndex = 32 Top = 2160 Width = 1815 End Begin VB.Label Label16 Caption = "Related events: No specific events." Height = 255 Left = -74760 TabIndex = 30 Top = 3840 Width = 4575 End Begin VB.Label Label13 Caption = "Other related properties: None." Height = 255 Left = -74760 TabIndex = 31 Top = 4320 Width = 4575 End Begin VB.Label Label12 Caption = "Folder name:" Height = 255 Left = -74760 TabIndex = 28 Top = 1560 Width = 1095 End Begin VB.Label Label11 Caption = $"frmMethodDemo.frx":06DA Height = 855 Left = -74760 TabIndex = 27 Top = 480 Width = 6615 End Begin VB.Label Label10 Caption = $"frmMethodDemo.frx":07D2 Height = 1215 Left = -74760 TabIndex = 37 Top = 480 Width = 6615 End Begin VB.Label Label9 Caption = "Related events: Disconnected." Height = 255 Left = 240 TabIndex = 22 Top = 3600 Width = 4575 End Begin VB.Label Label8 Caption = "Other related properties: AccountName, FirewallType, FirewallAddress, FirewallPort, FirewallUserName, FirewallPassword." Height = 615 Left = 240 TabIndex = 23 Top = 4080 Width = 4575 End Begin VB.Label Label7 Caption = $"frmMethodDemo.frx":099D Height = 615 Left = 240 TabIndex = 21 Top = 480 Width = 6615 End End Begin ComctlLib.StatusBar barStatus Align = 2 'Align Bottom Height = 375 Left = 0 TabIndex = 79 Top = 6885 Width = 11790 _ExtentX = 20796 _ExtentY = 661 SimpleText = "" _Version = 327682 BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7} NumPanels = 2 BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 10231 MinWidth = 10231 Text = "File progress:" TextSave = "File progress:" Key = "" Object.Tag = "" EndProperty BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7} Object.Width = 10231 MinWidth = 10231 Text = "Global progress:" TextSave = "Global progress:" Key = "" Object.Tag = "" EndProperty EndProperty End Begin VB.ListBox lstMessages Height = 1425 Left = 4560 TabIndex = 76 Top = 5400 Width = 7095 End Begin VB.Frame frmOtherProperties Caption = "Other properties" Height = 1095 Left = 120 TabIndex = 9 Top = 2040 Width = 4335 Begin VB.OptionButton optASCII Caption = "ASCII" Height = 255 Left = 2520 TabIndex = 13 Tag = "&h3c00" Top = 480 Width = 855 End Begin VB.OptionButton optBinary Caption = "Binary" Height = 255 Left = 2520 TabIndex = 14 Tag = "&h3c00" Top = 720 Value = -1 'True Width = 855 End Begin VB.CheckBox chkAllocateStorage Caption = "&AllocateStorage" Height = 255 Left = 240 TabIndex = 10 Tag = "&h2800" Top = 360 Width = 1575 End Begin VB.CheckBox chkPassiveMode Caption = "PassiveMode" Height = 255 Left = 240 TabIndex = 11 Tag = "&h3cc0" Top = 720 Width = 1335 End Begin VB.Label Label5 Caption = "RepresentationType:" Height = 255 Left = 2400 TabIndex = 12 Top = 240 Width = 1575 End End Begin VB.Frame frmReadOnlyProperties Caption = "Read-only properties" Height = 1695 Left = 120 TabIndex = 15 Top = 3240 Width = 4335 Begin VB.TextBox txtCurrentState BackColor = &H8000000F& Height = 285 Left = 240 TabIndex = 19 Top = 1200 Width = 1815 End Begin VB.TextBox txtCurrentFolder BackColor = &H8000000F& Height = 315 Left = 240 TabIndex = 17 Top = 600 Width = 3855 End Begin VB.Label Label15 Caption = "CurrentState:" Height = 255 Left = 240 TabIndex = 18 Top = 960 Width = 1095 End Begin VB.Label Label14 Caption = "CurrentFolder:" Height = 255 Left = 240 TabIndex = 16 Top = 360 Width = 1095 End End Begin VB.Frame frmConnectionProperties Caption = "Connection properties" Height = 1815 Left = 120 TabIndex = 0 Top = 120 Width = 4335 Begin VB.TextBox txtPassword Height = 315 IMEMode = 3 'DISABLE Left = 2280 PasswordChar = "*" TabIndex = 8 Tag = "&h0001" Text = "quest" Top = 1320 Width = 1815 End Begin VB.TextBox txtUserName Height = 315 Left = 240 TabIndex = 6 Tag = "&h0001" Text = "anonymous" Top = 1320 Width = 1815 End Begin VB.TextBox txtServerAddress Height = 315 Left = 240 TabIndex = 2 Tag = "&h0001" Top = 600 Width = 2655 End Begin VB.TextBox txtServerPort Height = 315 Left = 3120 TabIndex = 4 Tag = "&h0001" Text = "21" Top = 600 Width = 975 End Begin VB.Label Label4 Caption = "Password:" Height = 255 Left = 2280 TabIndex = 7 Top = 1080 Width = 1815 End Begin VB.Label Label3 Caption = "UserName:" Height = 255 Left = 240 TabIndex = 5 Top = 1080 Width = 975 End Begin VB.Label Label1 Caption = "ServerAddress:" Height = 255 Left = 240 TabIndex = 1 Top = 360 Width = 1215 End Begin VB.Label Label2 Caption = "ServerPort:" Height = 255 Left = 3120 TabIndex = 3 Top = 360 Width = 975 End End Begin XceedFtpLibCtl.XceedFtp xFtp Left = 11160 Top = 5040 AccountName = "" AllocateStorage = 0 'False BackgroundProcessing= 0 'False CommandLogFilename= "" EventFilter = 8151 ListParsingFlags= 1 LocalDataAddress= "" LocalDataPort = 0 PassiveMode = -1 'True Password = "guest" RepresentationType= 0 ServerAddress = "" ServerPort = 21 UserName = "anonymous" FirewallType = 0 FirewallAddress = "" FirewallPort = 1080 FirewallUser = "" FirewallPassword= "" End Begin VB.Label Label6 Caption = "Messages:" Height = 255 Left = 4560 TabIndex = 75 Top = 5160 Width = 1215 End Attribute VB_Name = "frmMethodDemo" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False ' Xceed FTP Library - Method Demonstrator sample application ' Copyright (c) 2000 Xceed Software Inc. ' [frmMethodDemo.frm] ' This form module contains all the code for this sample ' application's form. ' This file is part of the Xceed FTP Library samples applications. ' The source code in this file is only intended as a supplement ' to Xceed FTP Library's documentation, and is provided "as is", ' without warranty of any kind, either expressed or implied. Option Explicit ' Private utility methods Private Sub AddErrorMessage(ByVal lCode As Long, ByVal sDesc As String) If lCode = 0 Then Call lstMessages.AddItem("Operation completed successfully!") Else Call lstMessages.AddItem("Error 0x" & Hex(lCode) & ": " & sDesc) End If End Sub Private Sub SetRelatedProperties(ByVal eMethod As EXceedFtpMethods) Dim xCtrl As Control Dim lVal As Long For Each xCtrl In Controls On Error Resume Next lVal = 0 lVal = Val(xCtrl.Tag) On Error GoTo 0 If lVal > 0 Then If (lVal And eMethod) > 0 Then xCtrl.BackColor = RGB(255, 128, 128) ElseIf TypeOf xCtrl Is TextBox Then xCtrl.BackColor = vbWindowBackground Else xCtrl.BackColor = vbButtonFace End If End If Next xCtrl End Sub Private Sub UpdateReadOnlyProperties() txtCurrentFolder.Text = xFtp.CurrentFolder ' Since we do not use the Xceed Ftp Library in background processing mode, ' we know the state can only be fstNotConnected or fstConnected. Only ' map these two to text! Select Case xFtp.CurrentState Case fstNotConnected txtCurrentState.Text = "Not connected" Case fstConnected txtCurrentState.Text = "Connected" Case Else txtCurrentState.Text = "Unexpected (" & CStr(xFtp.CurrentState) & ")" End Select End Sub ' Form loading and unloading Private Sub Form_Load() ' Some initializations Call UpdateReadOnlyProperties txtServerAddress.Text = xFtp.ServerAddress txtServerPort.Text = CStr(xFtp.ServerPort) txtUserName.Text = xFtp.UserName txtPassword.Text = xFtp.Password chkAllocateStorage.Value = IIf(xFtp.AllocateStorage, vbChecked, vbUnchecked) chkPassiveMode.Value = IIf(xFtp.PassiveMode, vbChecked, vbUnchecked) optASCII.Value = (xFtp.RepresentationType = frtASCII) optBinary.Value = Not optASCII End Sub Private Sub Form_Unload(Cancel As Integer) ' When we quit, we make sure to disconnect, to avoid a delay where the Xceed Ftp Library ' waits for all references to be released. If xFtp.CurrentState = fstConnected Then On Error Resume Next Call xFtp.Disconnect End If End Sub ' MouseMove handling for color information Private Sub btChangeCurrentFolder_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cChangeCurrentFolder) End Sub Private Sub btChangeToParentFolder_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cChangeToParentFolder) End Sub Private Sub btConnect_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cConnect) End Sub Private Sub btCreateFolder_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cCreateFolder) End Sub Private Sub btDeleteFile_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cDeleteFile) End Sub Private Sub btDisconnect_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cDisconnect) End Sub Private Sub btGetFolderContents_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cGetFolderContents) End Sub Private Sub btListFolderContents_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cListFolderContents) End Sub Private Sub btReceiveFile_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cReceiveFile) End Sub Private Sub btReceiveMultipleFiles_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cReceiveMultipleFiles) End Sub Private Sub btRemoveFolder_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cRemoveFolder) End Sub Private Sub btRenameFile_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cRenameFile) End Sub Private Sub btSendFile_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cSendFile) End Sub Private Sub btSendMultipleFiles_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cSendMultipleFiles) End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub frmConnectionProperties_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub frmInfo_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub frmOtherProperties_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub frmReadOnlyProperties_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub lstContents_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub lstMessages_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub Private Sub tabMethods_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Call SetRelatedProperties(cNone) End Sub ' Disable keyboard on some edit fields Private Sub txtCurrentFolder_KeyPress(KeyAscii As Integer) KeyAscii = 0 End Sub Private Sub txtCurrentState_KeyPress(KeyAscii As Integer) KeyAscii = 0 End Sub ' Information about the control with the focus Private Sub chkAllocateStorage_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'AllocateStorage' property" lblInfo.Caption = cAllocateStorageInfo End Sub Private Sub chkAppend_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the append parameter" lblInfo.Caption = cAppendInfo End Sub Private Sub chkRecursive_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the process subfolders parameter" lblInfo.Caption = cProcessSubfoldersInfo End Sub Private Sub chkPassiveMode_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'PassiveMode' property" lblInfo.Caption = cPassiveModeInfo End Sub Private Sub optASCII_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'RepresentationType' property" lblInfo.Caption = cAsciiRepresentationTypeInfo End Sub Private Sub optBinary_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'RepresentationType' property" lblInfo.Caption = cBinaryRepresentationTypeInfo End Sub Private Sub txtDestination_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the destination filename or folder parameter" lblInfo.Caption = cDestinationFilenameInfo End Sub Private Sub txtFolderMask_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the folder mask parameter" lblInfo.Caption = cFolderMaskInfo End Sub Private Sub txtFolderName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the folder name parameter" lblInfo.Caption = cFolderNameInfo End Sub Private Sub txtNewFilename_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the new filename parameter" lblInfo.Caption = cNewFilenameInfo End Sub Private Sub txtOffset_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the starting offset parameter" lblInfo.Caption = cOffsetInfo End Sub Private Sub txtPassword_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'Password' property" lblInfo.Caption = cPasswordInfo End Sub Private Sub txtRemoteFilename_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the remote filename parameter" lblInfo.Caption = cRemoteFilenameInfo End Sub Private Sub txtServerAddress_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'ServerAddress' property" lblInfo.Caption = cServerAddressInfo End Sub Private Sub txtServerPort_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'ServerPort' property" lblInfo.Caption = cServerPortInfo End Sub Private Sub txtSource_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the source filename or mask parameter" lblInfo.Caption = cSourceFilenameInfo End Sub Private Sub txtUserName_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) frmInfo.Caption = "Information about the 'UserName' property" lblInfo.Caption = cUserNameInfo End Sub ' The actual method calls to the Xceed Ftp Library. The ActiveX uses the ' error object to report error to you. You can either use an On Error Resume Next ' or On Error Goto Label directive to handle errors. Private Sub btConnect_Click() On Error GoTo LocalError ' Set required properties xFtp.ServerAddress = txtServerAddress.Text xFtp.ServerPort = txtServerPort.Text xFtp.UserName = txtUserName.Text xFtp.Password = txtPassword.Text ' Simply call Connect to tell the Xceed Ftp Control to connect to the ' specified server. Call xFtp.Connect LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btDisconnect_Click() On Error GoTo LocalError ' No specific property required ' Simply call the Disconnect method to disconnect from the FTP server Call xFtp.Disconnect LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btChangeCurrentFolder_Click() On Error GoTo LocalError ' No specific property required ' Simply call ChangeCurrentFolder with the folder name to change to Call xFtp.ChangeCurrentFolder(txtFolderName.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btChangeToParentFolder_Click() On Error GoTo LocalError ' No specific property required ' Simply call ChangeToParentFolder Call xFtp.ChangeToParentFolder LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btCreateFolder_Click() On Error GoTo LocalError ' No specific property required ' Simply call CreateFolder with the folder to create Call xFtp.CreateFolder(txtFolderName.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btRemoveFolder_Click() On Error GoTo LocalError ' No specific property required ' Simply call RemoveFolder with the new folder to create Call xFtp.RemoveFolder(txtFolderName.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btGetFolderContents_Click() On Error GoTo LocalError ' Set some properties xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) ' Empty list view lstContents.ListItems.Clear ' Simply call ListFolderContents with the file mask to look for Call xFtp.ListFolderContents(txtFolderMask.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btListFolderContents_Click() On Error GoTo LocalError ' Set some properties xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) ' Empty list view lstContents.ListItems.Clear ' The GetFolderContents will return a new instance of the ' XceedFtpFolderItems collection Dim xItems As XceedFtpFolderItems Set xItems = xFtp.GetFolderContents(txtFolderMask.Text, fcfCollection) ' Then, we can enumerate each item in the collection Dim xItem As XceedFtpFolderItem Dim xListItem As ListItem For Each xItem In xItems Set xListItem = lstContents.ListItems.Add(, , xItem.ItemName) Select Case xItem.ItemType Case fitFile xListItem.SubItems(1) = "file" Case fitFolder xListItem.SubItems(1) = "dir" Case fitLink xListItem.SubItems(1) = "link" End Select Next xItem LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btDeleteFile_Click() On Error GoTo LocalError ' No specific property required ' Simply call DeleteFile with the filename to delete Call xFtp.DeleteFile(txtRemoteFilename.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btReceiveFile_Click() On Error GoTo LocalError ' Set some properties xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) xFtp.RepresentationType = IIf(optASCII.Value, frtASCII, frtBinary) ' Reset progress bars barFile.Value = 0 barGlobal.Value = 0 ' Call the ReceiveFile method with the source and destination filenames, ' and the offset to start the transfer from. Call xFtp.ReceiveFile(txtSource.Text, Val(txtOffset.Text), txtDestination.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btReceiveMultipleFiles_Click() On Error GoTo LocalError ' Set some properties xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) xFtp.RepresentationType = IIf(optASCII.Value, frtASCII, frtBinary) ' Reset progress bars barFile.Value = 0 barGlobal.Value = 0 ' Call the ReceiveMultipleFiles method with the source mask, destination folder, ' and wether or not to process subfolders. Call xFtp.ReceiveMultipleFiles(txtSource.Text, txtDestination.Text, (chkRecursive.Value = vbChecked)) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btRenameFile_Click() On Error GoTo LocalError ' No specific property required ' Simply call RenameFile with the original and the new filename Call xFtp.RenameFile(txtRemoteFilename.Text, txtNewFilename.Text) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btSendFile_Click() On Error GoTo LocalError ' Set some properties xFtp.AllocateStorage = (chkAllocateStorage.Value = vbChecked) xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) xFtp.RepresentationType = IIf(optASCII.Value, frtASCII, frtBinary) ' Reset progress bars barFile.Value = 0 barGlobal.Value = 0 ' Call the SendFile method with the source and destination filenames, ' the offset to start the transfer from, and wether or not to append to ' any existing file instead of overwriting. Call xFtp.SendFile(txtSource.Text, Val(txtOffset.Text), txtDestination.Text, (chkAppend.Value = vbChecked)) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub Private Sub btSendMultipleFiles_Click() On Error GoTo LocalError ' Set some properties xFtp.AllocateStorage = (chkAllocateStorage.Value = vbChecked) xFtp.PassiveMode = (chkPassiveMode.Value = vbChecked) xFtp.RepresentationType = IIf(optASCII.Value, frtASCII, frtBinary) ' Reset progress bars barFile.Value = 0 barGlobal.Value = 0 ' Call the SendMultipleFiles method with the source mask, destination folder, ' wether or not to append to any existing file instead of overwriting, ' and wether or not to look in subfolders for matching files. Call xFtp.SendMultipleFiles(txtSource.Text, txtDestination.Text, (chkAppend.Value = vbChecked), (chkRecursive.Value = vbChecked)) LocalError: Call AddErrorMessage(Err.Number, Err.Description) ' Update read-only properties Call UpdateReadOnlyProperties End Sub ' Xceed Ftp Library handled events Private Sub xFtp_Disconnected() ' The connection with the FTP server was terminated. Call lstMessages.AddItem("Disconnected!") End Sub Private Sub xFtp_FileTransferStatus(ByVal sLocalFilename As String, _ ByVal sRemoteFilename As String, _ ByVal lFileSize As Long, _ ByVal lBytesTransferred As Long, _ ByVal nBytesPercent As Integer, _ ByVal lTotalSize As Long, _ ByVal lTotalBytesTransferred As Long, _ ByVal nTotalBytesPercent As Integer, _ ByVal lTotalFiles As Long, _ ByVal lTotalFilesTransferred As Long, _ ByVal nTotalFilesPercent As Integer, _ ByVal lBytesPerSecond As Long, _ ByVal lTotalBytesPerSecond As Long) ' Information about the current file transfer. We update the progress bars. barFile.Value = nBytesPercent barGlobal.Value = nTotalBytesPercent End Sub Private Sub xFtp_ListingFolderItem(ByVal sName As String, ByVal dtDate As Date, ByVal lFileSize As Long, ByVal eItemType As XceedFtpLibCtl.EXFFolderItemType, ByVal sUserData As String) ' The ListFolderContents method found an item! Dim xItem As ListItem Set xItem = lstContents.ListItems.Add(, , sName) Select Case eItemType Case fitFile xItem.SubItems(1) = "file" Case fitFolder xItem.SubItems(1) = "dir" Case fitLink xItem.SubItems(1) = "link" End Select End Sub Private Sub xFtp_LoggingCommandLine(ByVal sLine As String, ByVal eCommandType As XceedFtpLibCtl.EXFCommandType) ' Any incoming or outgoing command line. Call lstMessages.AddItem(IIf(eCommandType = fctClientCommand, " > ", " < ") & sLine) End Sub Private Sub xFtp_ReceivingFile(ByVal sRemoteFilename As String, sLocalFilename As String, ByVal lFileSize As Long) ' This file is about to be received. Call lstMessages.AddItem("Receiving " & sRemoteFilename & " as " & sLocalFilename) End Sub Private Sub xFtp_ReplacingFile(sFilename As String, ByVal dtDate As Date, ByVal lFileSize As Long, ByVal sRemoteFilename As String, eAction As XceedFtpLibCtl.EXFReplaceAction) ' This file already exists locally. Dim xAnswer As VbMsgBoxResult xAnswer = MsgBox("File " & sFilename & " already exists. Do you want to replace it?", vbYesNoCancel, "Existing file") Select Case xAnswer Case vbYes eAction = fraOverwrite Case vbNo eAction = fraSkip Case Else eAction = fraSkip xFtp.Abort = True End Select End Sub Private Sub xFtp_ScanningFolder(ByVal sFolder As String, bSkipFolder As Boolean) ' Scanning a folder for matching files. Call lstMessages.AddItem("Scanning the contents of " & sFolder) End Sub Private Sub xFtp_SendingFile(ByVal sLocalFilename As String, sRemoteFilename As String, ByVal lFileSize As Long) ' This file is about to be sent. Call lstMessages.AddItem("Sending file " & sLocalFilename & " as " & sRemoteFilename) End Sub Private Sub xFtp_SkippingFile(ByVal sLocalFilename As String, ByVal sRemoteFilename As String, ByVal eSkippingReason As XceedFtpLibCtl.EXFError) ' This file could not be transferred. Call lstMessages.AddItem("Skipping file " & sLocalFilename & " (" & xFtp.GetResultDescription(eSkippingReason) & ")") End Sub